package cn.flying.cloud.system.api.feign;

import javax.annotation.Resource;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.flying.cloud.system.api.ParamServiceApi;
import cn.flying.cloud.system.param.entity.SysParamInfo;
import cn.flying.cloud.system.param.service.SysParamInfoService;

/**
 * 系统参数服务接口
 *
 * @author: admin
 * @date: 2025年04月17日 00:08
 * @version: 1.0
 */
@RestController
@RequestMapping("/system/param/api")
public class ParamApiController implements ParamServiceApi {

    @Resource
    private SysParamInfoService sysParamInfoService;

    /**
     * 根据key查询参数值
     *
     * @param key
     * @return
     */
    @Override
    public Map<String, String> getParam(String key) {
        SysParamInfo info = new SysParamInfo();
        info.setParamKey(key);
        SysParamInfo sysParamInfo = sysParamInfoService.getOneObj(info);
        Map<String, String> map = new HashMap<>();
        map.put(sysParamInfo.getParamKey(), sysParamInfo.getParamValue());
        return map;
    }
}
